package com.zmn.plat.common.dictionary;

/**
 * 消息等级枚举
 *
 * @author linfeng
 * @since 2020/07/09 14:56:30
 */
public enum MsgLevelEnum {

    /**
     * values
     */
    LOW(1, "低"),
    MIDDLE(2, "中"),
    HIGH(3, "高")
    ;

    private Integer code;
    private String name;

    MsgLevelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static MsgLevelEnum of(Integer code) {
        if (code == null || code == 0) {
            return LOW;
        }
        switch (code) {
            case 1:
                return LOW;
            case 2:
                return MIDDLE;
            case 3:
                return HIGH;
            default:
                return LOW;
        }
    }
}
